package io.renren.modules.business.service.impl;

import io.renren.modules.business.dao.BusProjectDeveloperDao;
import io.renren.modules.business.entity.BusProjectDeveloperEntity;
import io.renren.modules.business.entity.BusRecruitmentPlanEntity;
import io.renren.modules.business.service.BusProjectDeveloperService;
import io.renren.modules.business.util.PageLastUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;


@Service("busProjectDeveloperService")
public class BusProjectDeveloperServiceImpl extends ServiceImpl<BusProjectDeveloperDao, BusProjectDeveloperEntity> implements BusProjectDeveloperService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String userName = (String) params.get("userName");
        List<Map<String, Object>> list;
        if (!"".equals(userName) && userName.length()!=0) {
            //关键字查询
            list = baseMapper.developerKey(userName);
        }else {
            //查询列表
            list = baseMapper.developerList();
        }
        return PageLastUtil.getPageUtils(params, list);
    }

    /**
     * 根据团队编码判断团队是否有队长
     * @param teamId
     * @return
     */
    public boolean isLeader(Long teamId) {
        List<BusProjectDeveloperEntity> list = baseMapper.isLeader(teamId);
        return list.size() != 0;
    }
}